package com.cn.qtms.feign;//类注释设置模板

import com.cn.qtms.common.tree.Tree;
import com.cn.qtms.feign.error.KeepErrMsgConfiguration;
import com.cn.qtms.entity.vo.sys.Resource;
import com.cn.qtms.entity.vo.sys.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Set;

/**
 * @Name:SysService
 * @Description:
 * @Author: zhangyang
 * @Date 2019-11-13 17:46
 **/
@FeignClient(value = "qtms-sys",configuration={KeepErrMsgConfiguration.class})
public interface SysService {
    /**
     * 根据用户名获取用户对象
     * @param username
     * @return
     */
    @RequestMapping(value = "/user/findByUserName", method = RequestMethod.GET)
    User findByUserName(@RequestParam("username") String username);

    /**
     * 根据手机号获取用户对象
     * @param phone
     * @return
     */
    @RequestMapping(value = "/user/findByPhone", method = RequestMethod.GET)
    User findByPhone(@RequestParam("phone") String phone);

    /**
     * 获取用户对象的角色菜单
     * @param roles
     * @return
     */
    @RequestMapping(value = "/role/findRoleResource", method = RequestMethod.GET)
    List<Tree<Resource>> findRoleResource(@RequestParam("roles") Set<String> roles );

    /**
     * 获取用户对象的角色菜单集合
     * @param roles
     * @return
     */
    @RequestMapping(value = "/role/findRolePermission", method = RequestMethod.GET)
    List<String> findRolePermission(@RequestParam("roles") Set<String> roles );

}
